package ch.justdoit.andriodrpncalc.model.command;

import ch.justdoit.andriodrpncalc.model.CalcNumber;
import ch.justdoit.andriodrpncalc.model.Model;

public class EchoCommand extends BaseCommand {

	public EchoCommand(Model _model) {
		super(_model);
		mCommandName = "echo";
	}

	@Override
	public boolean doit() {
		CalcNumber lastNumberInStack = mModel.stack.PeekNumber(mModel.getCursorPosition());
		if (lastNumberInStack != null) {
			//mModel.setPromptNumber(lastNumberInStack);
			mModel.getPromptText().setTokens(lastNumberInStack.getTokens());
		}
		return false;
	}

	@Override
	public boolean undo() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public ICommand createNewInstance() {
		return new EchoCommand(mModel);
	}

}
